package com.helloworld.springcloud;

import com.helloworld.springcloud.config.MyselfRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.AutoConfigurationExcludeFilter;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.TypeExcludeFilter;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;

/**
 * Copyright (C), XXX 软件公司
 * FileName: OrderMain80
 * Author:   sisyphus
 * Date:     2021/6/28
 * Description:
 */

@SpringBootApplication
@EnableEurekaClient
@ComponentScan(
        excludeFilters = {@ComponentScan.Filter(
                type = FilterType.CUSTOM,
                classes = {TypeExcludeFilter.class}
        ), @ComponentScan.Filter(
                type = FilterType.CUSTOM,
                classes = {AutoConfigurationExcludeFilter.class}
        ),@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
                classes = {MyselfRule.class})}   // ribbon 这个自定义负载均衡的配置类不能放在ComponentScan 所扫描的当前包及其子包下面
                                                 // ，否则我们自定义的这个配置类就会被所有的Ribbon客户端所共享，达不到特殊化的目的
)
@RibbonClient(name = "CLOUD-PAYMENT-SERVICE",configuration = MyselfRule.class)
public class OrderMain80 {
    public static void main(String[] args) {
        SpringApplication.run(OrderMain80.class,args);
    }
}

